<%@ Page Title="" Language="C#" MasterPageFile="~/Views/Shared/Site.Master" Inherits="System.Web.Mvc.ViewPage<IEnumerable<StockExchanger.Models.BuySell>>" %>

<asp:Content ID="Content1" ContentPlaceHolderID="TitleContent" runat="server">
	Your Selling & Buying Items
</asp:Content>

<asp:Content ID="Content2" ContentPlaceHolderID="MainContent" runat="server">

    <h2>My Buying & Selling Items</h2>

    <table>
        <tr>
            <th></th>
<!--
            <th>
                Id
            </th>
 -->
            <th>
                ListedBy
            </th>
            <th>
                Item
            </th>
            <th>
                Quantity
            </th>
            <th>
                Rate
            </th>
            <th>
                StartDate
            </th>
            <th>
                BoughtBy
            </th>
            <th>
                EndDate
            </th>
            <th>
                IsSold
            </th>
            <th>
                Description
            </th>
        </tr>

    <% foreach (var item in Model)
       {
           if ((item.ListedBy == Page.User.Identity.Name) || (item.BoughtBy == Page.User.Identity.Name))
           { %>
    
        <tr>
            <td>
 <!--               <%= Html.ActionLink("Edit", "Edit", new { id=item.BuySellId }) %> |     -->
                <%= Html.ActionLink("Details", "Details", new { id = item.BuySellId })%>
            </td>
            <!--
            <td>
                <%= Html.Encode(item.Id) %>
            </td>
            -->
            <td>
                <%= Html.Encode(item.ListedBy)%>
            </td>
            <td>
                <%= Html.Encode(item.Item)%>
            </td>
            <td>
                <%= Html.Encode(String.Format("{0:F}", item.Quantity))%>
            </td>
            <td>
                <%= Html.Encode(String.Format("{0:F}", item.Rate))%>
            </td>
            <td>
                <%= Html.Encode(String.Format("{0:g}", item.StartDate))%>
            </td>
            <td>
                <%= Html.Encode(item.BoughtBy)%>
            </td>
            <td>
                <%= Html.Encode(String.Format("{0:g}", item.EndDate))%>
            </td>
            <td>
                <%= Html.Encode(item.Sold)%>
            </td>
            <td>
                <%= Html.Encode(item.Description)%>
            </td>
        </tr>
    
    <% }
       } %>

    </table>

    <p>
        <%= Html.ActionLink("Sell a New Item", "Sell") %>
        <%= Html.ActionLink("Buy a New Item", "ShareList") %>
    </p>


</asp:Content>

